export default {
  seachList(seachchange, page, pagesize) {
    let Searchlist = []
    let totalList = {
      currentPage: null,
      pageSize: null,
      total: null,
      totalPage: null
    }
    const res = window.api.pageAlert(JSON.stringify(seachchange), page, pagesize)

    // 当前页
    totalList.currentPage = res?.getPageSync()
    // 每页数量
    totalList.pageSize = res?.getPageSizeSync()
    // 总页数
    totalList.totalPage = res?.getTotalPageSync()
    // 总条数
    totalList.total = res?.getTotalSync()

    const size = res?.sizeSync()

    for (let i = 0; i < size; i++) {
      const result = res?.getSync(i)
      const ExecutionPolicy = result.getSync('ExecutionPolicy')
      const communicationMethod = result.getSync('communicationMethod')
      const frequency = result.getSync('frequency')
      const id = result.getSync('id')
      const name = result.getSync('name')
      const notificationContact = result.getSync('notificationContact')
      const time = result.getSync('time')
      const status = result.getSync('status')

      let list = {
        id: id,
        ExecutionPolicy: ExecutionPolicy,
        name: name,
        communicationMethod: communicationMethod,
        frequency: frequency,
        notificationContact: notificationContact,
        time: time,
        status: status,
      }
      Searchlist.push(list)
    }
    return { totalList, Searchlist }
  }
}
